export default {
    state:{
        userinfo:{
            uid:'',
            openid:'',
        },
        m_openid:'oiDT30UnegFQxj2oXfqFLhsFAV4w',
        m_uid:'0091001709',
        m_token:'',
    },
    mutations:{
        SET_USERINFO (state,userinfo) {
            state.userinfo = userinfo;
            sessionStorage.setItem('m_userinfo',userinfo);
        },
        SET_OPENID (state,openid) {    //设置openid
            state.m_openid = openid;
            sessionStorage.setItem('m_openid',openid);
        },
        SET_UID (state,uid) {    //设置uid
            state.m_uid = uid;
            sessionStorage.setItem('m_uid',uid);
        },
        SET_TOKEN (state,token) {    //设置uid
            state.m_token = token;
            sessionStorage.setItem('m_token',token);
        },
    },
    actions:{
        actionUid ({commit},uid) {
            commit('SET_UID',uid);
        },
        actionOpenid ( {commit}, openid) {
            // 赋值给store变量
            commit('SET_OPENID',openid);
        },
        actionToken ( {commit}, token) {
            // 赋值给store变量
            commit('SET_TOKEN',token);
        }
    }
}